package com.rm.zeyou.controller;


import com.rm.zeyou.constant.CommonConstants;
import com.rm.zeyou.response.ApiRestResponse;
import com.rm.zeyou.util.sms.SmsService;
import com.rm.zeyou.vo.request.SendCodeRequestVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@Api(tags = "短信模块")
@RequestMapping("/api/sms")
public class SmsController {
    @Resource
    private SmsService smsService;

    /**
     * 注册发送验证码
     *
     * @param requestVo
     * @return
     */
    @ApiOperation("注册发送验证码")
    @PostMapping("/userLoginSendCode")
    public ApiRestResponse userRegisterSendCode(@RequestBody SendCodeRequestVo requestVo) throws Exception {
        return smsService.sendCode(requestVo.getTel(), CommonConstants.SMS_USER_LOGIN);
    }


    /**
     * 忘记密码发送验证码
     */
    @ApiOperation("忘记密码发送验证码")
    @PostMapping("/userForgetPasswordSendCode")
    public ApiRestResponse userForgetPasswordSendCode(@RequestBody SendCodeRequestVo requestVo) throws Exception {
        return smsService.sendCode(requestVo.getTel(), CommonConstants.SMS_USER_FORGET_PASSWORD);
    }

    /**
     * 用户绑定手机号发送验证码
     */
    @ApiOperation("用户绑定手机号发送验证码")
    @PostMapping("/userBindTelSendCode")
    public ApiRestResponse userBindTelSendCode(@RequestBody SendCodeRequestVo requestVo) throws Exception {
        return smsService.sendCode(requestVo.getTel(), CommonConstants.USER_BLIND_TEL);
    }


    /**
     * 技师入住发送验证码
     */
    @ApiOperation("技师入住发送验证码")
    @PostMapping("/applyRecruitmentSendCode")
    public ApiRestResponse applyRecruitmentSendCode(@RequestBody SendCodeRequestVo requestVo) throws Exception {
        return smsService.sendCode(requestVo.getTel(), CommonConstants.APPLY_RECRUITMENT);
    }

    /**
     * 城市合伙人申请发送验证码
     */
    @ApiOperation("城市合伙人申请发送验证码")
    @PostMapping("/applyPartnerSendCode")
    public ApiRestResponse applyPartnerSendCode(@RequestBody SendCodeRequestVo requestVo) throws Exception {
        return smsService.sendCode(requestVo.getTel(), CommonConstants.APPLY_PARTNER);
    }

    /**
     * 技师修改密码发送验证码
     */
    @ApiOperation("技师修改密码发送验证码")
    @PostMapping("/technicianReplacePassSendCode")
    public ApiRestResponse technicianReplacePassSendCode(@RequestBody SendCodeRequestVo requestVo) throws Exception {
        return smsService.sendCode(requestVo.getTel(), CommonConstants.TECHNICIAN_REPLACE_PASS);
    }

    /**
     * 技师修改手机号验证发送验证码
     */
    @ApiOperation("技师修改手机号验证发送验证码")
    @PostMapping("/technicianUpdateTelVerifySendCode")
    public ApiRestResponse technicianUpdateTelVerifySendCode(@RequestBody SendCodeRequestVo requestVo) throws Exception {
        return smsService.sendCode(requestVo.getTel(), CommonConstants.TECHNICIAN_REPLACE_TEL_VERIFY);
    }

    /**
     * 技师更换手机号发送验证码
     */
    @ApiOperation("技师更换手机号发送验证码")
    @PostMapping("/technicianUpdateTelSendCode")
    public ApiRestResponse technicianUpdateTelSendCode(@RequestBody SendCodeRequestVo requestVo) throws Exception {
        return smsService.sendCode(requestVo.getTel(), CommonConstants.TECHNICIAN_REPLACE_TEL);
    }



}
